<?php
/**
 * @file
 * Prompts user to authorize the application. Redirects to the main canvas page
 * if the user had already authorized the application.
 *
 * Usage:
 *  - A page that wants to prompt the user to authorize the application should
 *    include/require this page once and only once.
 *
 * Parameter(s):
 *  - $PATH_COMMON : Relative path from the calling page to the 'common'
 *                   directory (e.g. '../common/').
 *
 * Global variable(s) set:
 *  - None.
 *
 * Global variable(s) unset:
 *  - None.
 *
 * Exception(s):
 *  - None.
 *
 * This file includes/requires:
 *  - h_facebook.php
 *  - fb_facebook.php
 *  - exception_msg.php
 */

// header file(s) ==============================================================
require_once $PATH_COMMON . "php/h_facebook.php";


// implementation ==============================================================
// create facebook object
require_once $PATH_COMMON . "php/fb_facebook.php";
// prompts user to add application
try {
  $temp = $fb->require_login();
  if (true == isset($temp)) {
    $fb->redirect(FB_APP_URL_CANVAS);
  }
} catch (Exception $ex) {
  require $PATH_COMMON . "php/exception_msg.php";
}
?>
